package com.example.s.Activity.setting;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.text.Editable;
import android.text.InputFilter;
import android.text.TextWatcher;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.example.s.Activity.BaseActivity;
import com.example.s.R;

public class FeedbackActivity extends BaseActivity {
    private ImageView back;
    private TextView title;
    private TextView finish;
    private EditText content;
    private TextView maxSize;

    private void initView() {

        back = (ImageView) findViewById(R.id.back);
        title = (TextView) findViewById(R.id.title);
        finish = (TextView) findViewById(R.id.finish);
        content = (EditText) findViewById(R.id.content);
        maxSize = (TextView) findViewById(R.id.maxSize);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_feedback);
        initView();
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        content.setFilters(new InputFilter[]{new InputFilter.LengthFilter(300)});
        content.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {

            }

            @Override
            public void afterTextChanged(Editable s) {
                maxSize.setText(s.length() + "/300");
            }
        });
        
        finish.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //反馈请求

                Toast.makeText(FeedbackActivity.this, "反馈成功", Toast.LENGTH_SHORT).show();
            }
        });
    }


}
